#include "func.h"
#include <iostream>
#include <ctime>
void time_u::show_time(){
    current = localtime(&t);    //必须是引用
    std::cout<<"当前时间(没格式化): "<<std::asctime(current);

    char buffer[100];
    
    // 各种时间格式
    std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", current);
    std::cout << "日期: " << buffer << std::endl;
    
    std::strftime(buffer, sizeof(buffer), "%H:%M:%S", current);
    std::cout << "时间: " << buffer << std::endl;
    
    std::strftime(buffer, sizeof(buffer), "%c", current);
    std::cout << "完整日期时间: " << buffer << std::endl;
    
    std::strftime(buffer, sizeof(buffer), "%A", current);
    std::cout << "星期: " << buffer << std::endl;
}